<template>
	<view class="u-p-20">
		<mescroll-body ref="mescrollRef" :bottombar="false" @init="mescrollInit" @down="downCallback" @up="upCallback">
			<view class="">
				<view class="flex align-center u-p-20 bg-white u-m-b-20 rounded-10 box-shadow" v-for="(item,index) in list" :key="index">
					<u-image :src="item.goods_images" width="140rpx" height="140rpx" borderRadius="10"></u-image>
					<view class="flex-1 u-p-l-20" style="height: 100%;">
						<text class="u-font-24 text-ellipsis-2">{{item.goods_name}}</text>
						<view class="flex align-center justify-between u-p-y-10">
							<text>¥{{item.goods_price}}</text>
							<view class="" >
								<u-tag shape="circle" mode="dark" type="warning" text="查看订单详情" v-if="item.status == 0" @click="toPay(item)"></u-tag>
								<u-tag shape="circle" mode="plain" :text="item.status_text" color="#d22b1a" v-if="item.status == 1"></u-tag>
								<u-tag shape="circle" mode="plain" :text="item.status_text" color="#d22b1a" v-if="item.status == -1"></u-tag>
							</view>
						</view>
						<text class="text-greey">秒杀时间：{{item.seckilltime}}</text>
					</view>
				</view>
			</view>
		</mescroll-body>
	</view>
</template>

<script>
	import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
	import { SeckillCenterApi } from '@/api/serves.js'
	// import { seckillApi } from '@/api/seckillAjax.js'
	export default {
		mixins: [MescrollMixin], // 使用mixin
		data() {
			return {
				list: []
			}
		},
		methods: {
			// 上拉加载
			upCallback(page) {
				this.$ShowLoading()
				SeckillCenterApi.indexMySeckill().then(res => {
				  console.log('我的秒杀列表', res);
					this.$HideLoading()
				  if(res.code == 1){
						this.list = res.data
						this.mescroll.endByPage(10, 1)
				  }else {
						this.$Toast(res.msg)
					}
				})
				
			},
			toPay(item) {
				uni.navigateTo({
					url: '/pages/seckill/seckillOrderAdd/seckillOrderAdd?id=' + item.seckill_log_id
				})
			}
		}
	}
</script>

<style lang="scss" scoped>

</style>
